package com.qf.sy2103.seckill.controller;

import com.qf.sy2103.seckill.service.SeckillServcie;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/sec")
public class SecKillController {

    @Autowired
    SeckillServcie seckillServcie;

    @RequestMapping("/book/{id}")
    public String seckill(@PathVariable("id") Integer id){

        final boolean b = seckillServcie.bookSeckill(id);

        if (b){
            return "ok";
        }else {
            return "failed";
        }



    }

}
